package com.cyanite.playlv2.maps;

import com.cyanite.playlv2api.PlayLv2Api;
import com.cyanite.playlv2api.types.Checkin;
import com.cyanite.playlv2api.types.PlayLv2Type;
import com.cyanite.playlv2api.types.User;
import com.cyanite.playlv2api.types.Venue;

public class CheckinGroup implements PlayLv2Type {

    private Venue mVenue;
    private String mDescription;
    private String mPhotoUrl;
    private String mGender;
    private int mCheckinCount;
    private int mLatE6;
    private int mLonE6;

    public CheckinGroup() {
    	mVenue = null;
        mDescription = "";
        mPhotoUrl = "";
        mCheckinCount = 0;
        mGender = PlayLv2Api.MALE;
    }

    public void appendCheckin(Checkin checkin) {
        User user = checkin.getUser();
        if (mCheckinCount == 0) {
            mPhotoUrl = user.getPhoto();
            mGender = user.getGender();
            mDescription += user.getUserName();

            Venue venue = checkin.getVenue();
            mVenue = venue;
            mLatE6 = (int)(Double.parseDouble(venue.getGeolat()) * 1E6);
            mLonE6 = (int)(Double.parseDouble(venue.getGeolong()) * 1E6);
        } else {
            mDescription += ", " + user.getUserName();
        }
        mCheckinCount++;
    }

    public Venue getVenue() {
        return mVenue;
    }

    public int getLatE6() {
        return mLatE6;
    }

    public int getLonE6() {
        return mLonE6;
    }

    public String getDescription() {
        return mDescription;
    }

    public String getPhotoUrl() {
        return mPhotoUrl;
    }

    public String getGender() {
        return mGender;
    }

    public int getCheckinCount() {
        return mCheckinCount;
    }
}
